package com.maomao.maomaochong_i;

import android.annotation.SuppressLint;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.maomao.maomaochong_i.fenLeiPackage.FenLeiPage;
import com.maomao.maomaochong_i.guowuche.ShiJian;
import com.maomao.maomaochong_i.personalPackage.PersonalPage;
import com.maomao.maomaochong_i.zhuye.ReceiveFactory.DingLang;

/**
 * Created by maomao on 2017/5/17.
 */

@SuppressLint("ValidFragment")
public class TuFragment extends Fragment {
    int number;
    private Context context;
    private FragmentManager fManager;
    private View maoView;
    private int BuJu[] = {R.layout.kongba,R.layout.shouye,R.layout.activity_fenlei,R.layout.kongba,
            R.layout.activity_personal};

    /**
     *
     * @param number 底部跳转的4个页面，从0开始计算
     */

    public TuFragment(int number){
        this.number = number;
    }

    public TuFragment(Context context, FragmentManager fManager,int number){
        this.context = context;
        this.fManager = fManager;
        this.number = number;
    }

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
            System.out.println(number);
        switch (number) {
            case 1:
                maoView = new DingLang(inflater,container).getView();
                break;

            case 2:
                maoView = new FenLeiPage().useFenLei(context, inflater, container, fManager);
                break;

            case 3:
                ShiJian ceshi = ShiJian.getOne(inflater,container);
                maoView = ceshi.getView();
                  
                break;

            case 4:
                maoView = new PersonalPage().usePersonal(context, inflater, container);
                break;
        }
        return maoView;
    }

    public View getMaoView(){
        return maoView;
    }

}
